Avoid excess icache flushes in populate_physmap() before domain has been created
authorPunit Agrawal <punit.agrawal@arm.com>
Fri, 26 May 2017 11:14:07 +0000 (12:14 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 6 Jun 2017 18:49:39 +0000 (11:49 -0700)
commit726b737574a3c075be95440e572b317a39293a9e
treeb0de4e116c978b7f79a138106636e421d01dae1f
parent1a0c3e3e28d6cd072734990efcaaec608bf152b1
Avoid excess icache flushes in populate_physmap() before domain has been created

populate_physmap() calls alloc_heap_pages() per requested
extent. alloc_heap_pages() invalidates the entire icache per
extent. During domain creation, the icache invalidations can be deffered
until all the extents have been allocated as there is no risk of
executing stale instructions from the icache.

Introduce a new flag "MEMF_no_icache_flush" to be used to prevent
alloc_heap_pages() from performing icache maintenance operations. Use
the flag in populate_physmap() before the domain has been unpaused and
perform required icache maintenance function at the end of the
allocation.

One concern is the lack of synchronisation around testing for
"creation_finished". But it seems, in practice the window where it is
out of sync should be small enough to not matter.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/common/memory.c
xen/common/page_alloc.c
xen/include/asm-x86/page.h
xen/include/xen/mm.h